//
//  DataModel.swift
//  FirstSwiftProduct
//
//  Created by 范泽华 on 2017/10/12.
//  Copyright © 2017年 范泽华. All rights reserved.
//

import UIKit
import YYKit
class DataModel: NSObject {

    var resource = [resourData]()
    
    
    func getModelData(message:@escaping(String)->(),successModel:@escaping(Array<Any>)->()) -> Void {
        
        HttpTool.shareTool.requestJsonDataWithUrl(Type: .get, url: kHotLiveAPI, parames: [:], succeed: { (successmMessage, result) in
            //成功
            let model = DataModel.model(withJSON: result as AnyObject)
            self.resource = (model?.resource)!
            
            message(successmMessage!)
            successModel(self.resource)
           
        }, error: { (error) in
            //错误
            
        }) { (fail) in
            //错误
            
        }
        
        
//        HttpTool.shareTool.requestJsonDataWithUrl(Type: .post, url: "", parames: [:], succeed: { (success, respondsData) in
//
//            let model = DataModel.model(withJSON: respondsData as AnyObject)
//
//            self.getData(model: model!)
//
//            message("sucess")
//
//        }, error: Error) { (fail) in
//
//        }
    }
    
    func getData(model:DataModel) {
        resource = model.resource
    }
    
    
}

class resourData: NSObject {
    var action  : String!
    var image   : String!
    var name    : String!
    
    
    
}
